function TrTabs()
{    
    this.id =0;
    this.init=function (id)
    {
        this.id =id;
        this.view(1);
    };
    
    this.view = function(cid)
    {
        var _root   = this;
        var TabView = document.getElementById(this.id);
        var Tab = TabView.firstChild;
        var i = 0;
        var j = 0;
        while (true)
        {            
            if (Tab.tagName == "A")
            {
                i++;
                Tab.id=i;
                Tab.onclick=function()
                {
                    _root.view(this.id);
                };
                Tab.className = (i == cid) ? "c" : "";
                Tab.blur();
            }
            Tab = Tab.nextSibling;            
            if (Tab == null) {
                break
            }
        }
        var Pages = document.getElementById(this.id + "_pages");
        var Page = Pages.firstChild;
        var i = 0;
        do {
            if (Page.className == 'tab') {
                i++;
                Page.style.display = (i == cid) ? '' : 'none'
            }
        }while (Page = Page.nextSibling)
    };
}